//
//  BLMY_SiView.m
//  Byelone
//
//  Created by Qi Liu on 2021/2/10.
//

#import "BLMY_SiView.h"

@interface BLMY_SiView ()

@property(nonatomic,copy)NSDictionary * infoDic;

@end

@implementation BLMY_SiView

-(void)awakeFromNib{
    [super awakeFromNib];
    self.backgroundColor = BL_COLOR_ALPHA;
    self.awardLabel.textColor = [UIColor chColorWithHexString:@"#FF8705"];
    self.awardValue.textColor = [UIColor chColorWithHexString:@"#FF8705"];
    self.signSuccess.textColor =  [UIColor chColorWithHexString:@"#FF8705"];
}

+(void)showSiSuccView:(NSDictionary *)dic{
    BLMY_SiView * si = [[[NSBundle mainBundle]loadNibNamed:@"BLMY_SiView" owner:nil options:nil]lastObject];
    si.infoDic = dic;
    [BL_WINDOW addSubview:si];
}

-(void)setInfoDic:(NSDictionary *)infoDic{
    _infoDic = infoDic;
    NSString * str = [NSString stringWithFormat:@"+%@",[infoDic objectForKey:@"giftAmount"]];
    self.awardLabel.text = str;
    self.awardValue.text = @"我的贝壳:";
}

- (IBAction)disMissView:(UIButton *)sender {
    [UIView animateWithDuration:0.3 animations:^{
        self.alpha = 0;
    } completion:^(BOOL finished) {
        [self removeFromSuperview];
    }];
}

-(void)didMoveToSuperview{
    [super didMoveToSuperview];
//    
//    [UIView animateWithDuration:0.2 animations:^{
//        self.alpha = 0;
//    } completion:^(BOOL finished) {
//        [self removeFromSuperview];
//    }];
    
    
    [self performSelector:@selector(disMissView:) withObject:nil afterDelay:0.5];
    
}

@end
